#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 3005;

int n, m, q, r, k;
int a[N][N];
struct Node {
  int t, x, y;
};
void add_lake(int x1, int y1, int x2, int y2) {
  rep(i, x1, x2) rep(j, y1, y2) a[i][j] = -1;
}
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
bool near(int x, int y) {
  if (a[x][y] == -1) return false;
  rep(i, 0, 3) {
    int nx = x + dx[i], ny = y + dy[i];
    if (nx < 1 || nx > n || ny < 1 || ny > m) continue;
    if (a[nx][ny] == -1) return true;
  }
  return false;
}
bool check(int x, int y) {
  if (a[x][y] == -1) return false;
  rep(i, 0, 3) {
    int nx = x + dx[i], ny = y + dy[i];
    if (nx < 1 || nx > n || ny < 1 || ny > m) continue;
    if (a[nx][ny]) return true;
  }
  return false;
}
void add_tree(int x, int y) {
  if (a[x][y]) return;
  a[x][y] = 1;
  rep(i, 0, 3) {
    int nx = x + dx[i], ny = y + dy[i];
    if (nx < 1 || nx > n || ny < 1 || ny > m) continue;
    if (near(nx, ny)) add_tree(nx, ny);
  }
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> q >> r >> k;
  rep(i, 1, q) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    add_lake(x1, y1, x2, y2);
  }
  queue<Node> q1, q2;
  rep(i, 1, r) {
    int t, x, y;
    cin >> t >> x >> y;
    q1.push({t, x, y});
    q2.push({t + k, x, y});
  }
  while (q1.size()) {
    int t1 = q1.front().t, t2 = q2.front().t;
    if (t1 <= t2) {
      Node p = q1.front();
      q1.pop();
      add_tree(p.x, p.y);
    } else {
      Node p = q2.front();
      q2.pop();
      if (!check(p.x, p.y)) a[p.x][p.y] = 0;
    }
  }
  while (q2.size()) {
    Node p = q2.front();
    q2.pop();
    if (!check(p.x, p.y)) a[p.x][p.y] = 0;
  }
  int ans = 0;
  rep(i, 1, n) rep(j, 1, m) if (a[i][j] == 1) ans++;
  cout << ans;
  return 0;
}